#include<iostream>
#include<cstring>
using namespace std;

int count = 0;

int match(char *p1,char *p2,int len){
    for (int i = 1 ; i < len; i++)
    {
        if (*(p1+i) != *(p2+i))
        {
            return 0;
        } 
    }
    count++;
    return 1;
}

void strlower(char *a){
    for(int i = 0; a[i]; i ++ ) {
		if(isupper(a[i])) a[i] = tolower(a[i]);
	}
}

int main(int argc, char const *argv[])
{
    char str[11],article[1000001];
    int find,len;
    gets(str);
    len = strlen(str);
    gets(article);
    strlower(str);
    strlower(article);
    strcat(str," ");
    strcat(article," "); 

    
    for (int i = 0; article[i]; i++)
    {
      if(article[i+len]==' '&&(i==0||article[i-1]==' ')&&article[i]==str[0])
        {
            if(!count)find = i*match(article+i,str,strlen(str));
            else match(article+i,str,len);
        }
    }
    
    if(count)cout<<count<<" "<<find;
    else puts("-1");
    return 0;

}
